-/* exported getCurrentExtension, setExtensionManager, getSettings,
- initTranslations, gettext, ngettext, pgettext, openPrefs */
+import Gio from 'gi://Gio';
+import GLib from 'gi://GLib';
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-
-const Gettext = imports.gettext;
+import * as Gettext from 'gettext';
const Config = imports.misc.config;
/**
* @param {object} extensionManager to use in utilities like `initTranslations()`
*/
-function setExtensionManager(extensionManager) {
+export function setExtensionManager(extensionManager) {
if (_extensionManager)
throw new Error('Trying to override existing extension manager');
* @returns {?object} - The current extension, or null if not called from
* an extension.
*/
-function getCurrentExtension() {
+export function getCurrentExtension() {
const basePath = '/gnome-shell/extensions/';
// Search for an occurrence of an extension stack frame
*
* @param {string=} domain - the gettext domain to use
*/
-function initTranslations(domain) {
+export function initTranslations(domain) {
let extension = getCurrentExtension();
if (!extension)
*
* @returns {string} - the translated string
*/
-function gettext(str) {
+export function gettext(str) {
return callExtensionGettextFunc('gettext', str);
}
*
* @returns {string} - the translated string
*/
-function ngettext(str, strPlural, n) {
+export function ngettext(str, strPlural, n) {
return callExtensionGettextFunc('ngettext', str, strPlural, n);
}
*
* @returns {string} - the translated string
*/
-function pgettext(context, str) {
+export function pgettext(context, str) {
return callExtensionGettextFunc('pgettext', context, str);
}
* @param {string=} schema - the GSettings schema id
* @returns {Gio.Settings} - a new settings object for @schema
*/
-function getSettings(schema) {
+export function getSettings(schema) {
let extension = getCurrentExtension();
if (!extension)
/**
* Open the preference dialog of the current extension
*/
-function openPrefs() {
+export function openPrefs() {
const extension = getCurrentExtension();
if (!extension)